/**
 * @author zhounan 
 * @date 2024年6月24日
 * @version V1.0
 */
package org.zn.quality.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zn.quality.entity.QualityStrategyEntity;
import org.zn.quality.service.QualityManagerService;

/**
 * @author zhounan 
 * @date 2024年6月24日
 * @version V1.0
 */
@RestController
@RequestMapping("quality/manage")
public class QualityManagerController {

	@Autowired
	private QualityManagerService qualityManagerService;
	
	@PostMapping("strategy")
	public Object saveJobQuality(@RequestBody QualityStrategyEntity qs) {
		
		return qualityManagerService.save(qs);
	
	}
	
	
	@PostMapping("strategy/group")
	public Object batchAddJobQuality(@RequestBody QualityStrategyEntity qs) {
		
		return qualityManagerService.batchAdd(qs);
	
	}
	
	@GetMapping("strategy")
	public List<QualityStrategyEntity> jobQualityList(String jobName) {
	
		return qualityManagerService.queryJobStrategy(jobName);
	
	}
	
	@GetMapping("strategy/{id}")
	public QualityStrategyEntity queryStrategyEntityById(@PathVariable() Long id) {
	
		return qualityManagerService.queryStrategyEntityById(id);
	
	}
	
	
	@DeleteMapping("strategy")
	public Object deleteJobQuality(Long qualityId) {
		
		return qualityManagerService.delStrategy(qualityId);
	
	}
	
	@DeleteMapping("clear/job")
	public Object clearJobQuality(String jobName) {
		
		return null;
	
	}
	
}
